package com.todo.sight.application.api.controller;

import com.todo.common.common.entity.response.BizResponse;
import com.todo.sight.application.convert.SightInfoConvert;
import com.todo.sight.application.entity.bo.SightPoiBO;
import com.todo.sight.application.service.SightPoiService;
import com.todo.sight.service.api.SightPoiApi;
import com.todo.sight.service.api.request.QuerySightPoiByIdRequest;
import com.todo.sight.service.api.response.SightPoiDetailResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author azhebuxing
 * @date 2025/2/24 15:57
 * @description
 */
@RestController
@RequestMapping("/api/sightPoi")
@Tag(name = "服务端-景点poi详情接口", description = "服务端-景点poi详情接口")
public class SightPoiApiController implements SightPoiApi {

    @Resource
    private SightPoiService sightPoiService;


    @Override
    @Operation(summary = "根据poi主键查询详情")
    @PostMapping("/querySightPoiById")
    public BizResponse<SightPoiDetailResponse> querySightPoiById(QuerySightPoiByIdRequest request) {
        if (request == null || request.getPoiId() == null) {
            return BizResponse.paramError();
        }
        SightPoiBO sightPoiBO = sightPoiService.querySightPoiById(request.getPoiId());
        return BizResponse.success(SightInfoConvert.convertToSightPoiDetailResponse(sightPoiBO));
    }
}
